local lib, oldminor = LibStub:GetLibrary("LibInternalCooldowns-1.0")

local spellToItem =
{
	-- =======================
	-- == Mists of Pandaria ==
	-- =======================


	-- Item lvl 483, 496, 509 Trinkets
	[126646] = {86881, 86323, 87160},					-- Stuff of Nightmares LFR, Normal, HEROIC
	[126640] = {86885, 86327, 87163},					-- Spirits of the Sun LFR, Normal, HEROIC
	[126649] = {86890, 86332, 87167},					-- Terror in the Mists LFR, Normal, HEROIC
	[126657] = {86894, 86336, 87172},					-- Darkmist Vortex LFR, Normal, HEROIC
	[126659] = {86907, 86388, 87175},					-- Essence of Terror LFR, Normal, HEROIC

	-- Item lvl 476, 489, 502 Trinkets
	[126588] = {86805, 86147, 87075},					-- Qin-xi's Polarizing Seal LFR, Normal, HEROIC
	[126582] = {86802, 86144, 87072},					-- Lei Shin's Final Orders LFR, Normal, HEROIC
	[126577] = {86792, 86133, 87065},					-- Light of the Cosmos LFR, Normal, HEROIC
	[126533] = {86790, 86131, 87063},					-- Vial of Dragon's Blood LFR, Normal, HEROIC
	[126554] = {86791, 86132, 87057},					-- Bottle of Infinite Stars LFR, Normal, HEROIC
	[128986] = 79327,							-- Relic of Xuen STR
	[128984] = 79328,							-- Relic of Xuen AGI
	[128987] = 79330,							-- Relic of Chi Ji
	[128985] = 79331,							-- Relic of Yu'lon

	-- Item lvl 470 Trinkets
	[127923] = 87572,							-- Mithril Wristwatch
	[127915] = 87573,							-- Thousand-Year Pickled Egg
	[127928] = 87574,							-- Coren's Cold Chromium Coaster

	-- Item lvl 463 Trinkets
	[126236] = {85181, 81243},						-- Iron Protector Talisman Normal, HEROIC
	[126483] = 81125,							-- Windswept Pages HEROIC
	[126513] = 81138,							-- Carbonic Carbuncle HEROIC
	[126467] = 81266,							-- Price of Progress HEROIC
	[126489] = 81267,							-- Searing Words HEROIC
	[126476] = 81192,							-- Vision of the Predator HEROIC
	[126266] = 81133,							-- Empty Fruit Barrel HEROIC

	-- Item lvl 450 Trinkets
	[105574] = 75274,							-- Zen Alchemist Stone
	[126236] = 85181,							-- Iron Protector Talisman

	-- Item lvl 433 Trinkets
	[127572] = 87497,							-- Core of Decency



	-- ===============
	-- == Cataclysm ==
	-- ===============


	-- Kiril, Fury of Beasts
	[109864] = 78473,							-- Heroic
	[108011] = 77194,							-- Normal
	[109861] = 78482,							-- Raid Finder

	-- Ti'tahk, the Steps of Time
	[109844] = 78477,							-- Heroic
	[107804] = 77190,							-- Normal
	[109842] = 78486,							-- Raid Finder

	-- Gurthalak, Voice of the Deeps
	[109840] = 78478,							-- Heroic
	[107818] = 77191,							-- Normal
	[109838] = 78487,							-- Raid Finder

	-- Item lvl 410 Trinkets
	[109744] = 77992,							-- Creche of the Final Dragon HEROIC
	[109789] = 77991,							-- Insignia of the Corrupted Mind HEROIC
	[109804] = 77989,							-- Seal of the Seven Signs HEROIC
	[109776] = 77990,							-- Soulshifter Vortex HEROIC
	[109711] = 77993,							-- Starcatcher Compass HEROIC

	-- Item lvl 397 Trinkets
	[107988] = 77205,							-- Creche of the Final Dragon
	[107982] = {77202,77203,77204},						-- Starcatcher Compass, Insignia of the Corrupted Mind, Seal of the Seven Signs
	[107986] = 77206,							-- Soulshifter Vortex
	[97139] = 69150,							-- Matrix Restabilizer Haste HEROIC
	[97140] = 69150,							-- Matrix Restabilizer Crit HEROIC
	[97141] = 69150,							-- Matrix Restabilizer Mastery HEROIC

	-- Item lvl 391 Trinkets
	[97177] = 69199,							-- Ancient Petrified Seed HEROIC
	[97179] = 69200,							-- Essence of the Eternal Flame HEROIC
	[97176] = 69198,							-- Fiery Quintessence HEROIC
	[97120] = 69111,							-- Jaws of Defeat HEROIC
	[97146] = 69185,							-- Rune of Zeth HEROIC
	[96880] = 69109,							-- Scales of Life HEROIC
	[97129] = 69138,							-- Spidersilk Spindle HEROIC
	[97145] = 69184,							-- Stay of Execution HEROIC
	[97125] = 69112,							-- The Hungerer HEROIC

	-- Item lvl 384 Trinkets
	[109742] = 77972,							-- Creche of the Final Dragon LFR
	[109787] = 77971,							-- Insignia of the Corrupted Mind LFR
	[109802] = 77969,							-- Seal of the Seven Signs LFR
	[109774] = 77970,							-- Soulshifter Vortex LFR
	[109709] = 77973,							-- Starcatcher Compass LFR
	[96977] = 68994,							-- Matrix Restabilizer Haste
	[96978] = 68994,							-- Matrix Restabilizer Crit
	[96979] = 68994,							-- Matrix Restabilizer Mastery

	-- Item lvl 379 Trinkets
	[91173] = 60233,							-- Shard of Woe HEROIC

	-- Item lvl 378 Trinkets
	[97009] = 69001,							-- Ancient Petrified Seed
	[102659] = 72897,							-- Arrow of Time
	[97010] = 69002,							-- Essence of the Eternal Flame
	[97008] = 69000,							-- Fiery Quintessence
	[102662] = 72898,							-- Foul Gift of the Demon Lord
	[96907] = 68926,							-- Jaws of Defeat
	[109993] = 74035,							-- Master Pit Fighter
	[102660] = 72901,							-- Rosary of Light
	[97007] = 68998,							-- Rune of Zeth
	[96880] = 68915,							-- Scales of Life
	[96945] = 68981,							-- Spidersilk Spindle
	[96988] = 68996,							-- Stay of Execution
	[96911] = 68927,							-- The Hungerer
	[102664] = 72899,							-- Varo'then's Brooch
	[102667] = 72900,							-- Veil of Lies

	-- Item lvl 372 Trinkets
	[92318] = 65053,							-- Bell of Enraging Resonance HEROIC
	[92342] = 65118,							-- Crushing Weight HEROIC
	[92351] = 65140,							-- Essence of the Cyclone HEROIC
	[92332] = 65124,							-- Fall of Mortality HEROIC
	[92345] = 65072,							-- Heart of Rage HEROIC
	[92349] = 65026,							-- Prestor's Talisman of Machination HEROIC
	[92355] = 65048,							-- Symbiotic Worm HEROIC
	[92320] = 65105,							-- Theralion's Mirror HEROIC

	-- Item lvl 365 Trinkets
	[101287] = 71335,							-- Coren's Chilled Chromium Coaster
	[101291] = 71337,							-- Mithril Stopwatch
	[101289] = 71336,							-- Petrified Pickled Egg
	[109994] = 74034,							-- Pit Fighter

	-- Item lvl 359 Trinkets
	[92233] = 58182,							-- Bedrock Talisman
	[91007] = 59326,							-- Bell of Enraging Resonance
	[91821] = 59506,							-- Crushing Weight
	[89091] = 62047,							-- Darkmoon Card: Volcano
	[92126] = 59473,							-- Essence of the Cyclone
	[91184] = 59500,							-- Fall of Mortality
	[91816] = 59224,							-- Heart of Rage
	[91192] = {62467, 62472, 68711},					-- Mandala of Stirring Patterns
	[92124] = 59441,							-- Prestor's Talisman of Machination
	[91047] = {62465, 62470, 68710},					-- Stump of Time
	[92235] = 59332,							-- Symbiotic Worm
	[91024] = 59519,							-- Theralion's Mirror
	[92108] = 59520,							-- Unheeded Warning

	-- Item lvl 346 Trinkets
	[90992] = 56407,							-- Anhuur's Hymnal HEROIC
	[91149] = 56414,							-- Blood of Isiset HEROIC
	[92087] = 56295,							-- Grace of the Herald HEROIC
	[91364] = 56393,							-- Heart of Solace HEROIC
	[92091] = 56328,							-- Key to the Endless Chamber HEROIC
	[92184] = 56347,							-- Leaden Despair HEROIC
	[92094] = 56427,							-- Left Eye of Rajh HEROIC
	[92174] = 56280,							-- Porcelain Crab HEROIC
	[91368] = 56431,							-- Right Eye of Rajh HEROIC
	[91002] = 56400,							-- Sorrowsong HEROIC
	[91139] = 56351,							-- Tear of Blood HEROIC
	[90898] = 56339,							-- Tendrils of Burrowing Dark HEROIC
	[92205] = 56449,							-- Throngus's Finger HEROIC
	[90887] = 56320,							-- Witching Hourglass HEROIC

	-- Item lvl 308-333 Trinkets
	[90989] = 55889,							-- Anhuur's Hymnal
	[91147] = 55995,							-- Blood of Isiset
	[91363] = 55868,							-- Heart of Solace
	[92096] = 56102,							-- Left Eye of Rajh
	[91370] = 56100,							-- Right Eye of Rajh
	[90996] = 55879,							-- Sorrowsong
	[92208] = 56121,							-- Throngus's Finger
	[92166] = {65803, 65805, 65804, 55237},					-- Harrison's Insignia of Panache, Schnotzz's Medallion of Command, Talisman of Sinister Order, Porcelain Crab 
	[92052] = {66969, 55266},						-- Heart of the Vile, Grace of the Herald 
	[92069] = 55795,							-- Key to the Endless Chamber
	[92179] = 55816,							-- Leaden Despair
	[91141] = 55854,							-- Rainsong
	[91138] = 55819,							-- Tear of Blood
	[90896] = 55810,							-- Tendrils of Burrowing Dark
	[90885] = 55787,							-- Witching Hourglass



	-- ============================
	-- == Wrath of the Lich King ==
	-- ============================


	-- ICC Reputation Rings
	[72416] = {50398, 50397},						-- Ashen Band of Endless Destruction, Ashen Band of Unmatched Destruction
	[72418] = {50400, 50399},						-- Ashen Band of Endless Wisdom, Ashen Band of Unmatched Wisdom
	[72412] = {50402, 50401},						-- Ashen Band of Endless Vengeance, Ashen Band of Unmatched Vengeance
	[72414] = {50404, 50403},						-- Ashen Band of Endless Courage, Ashen Band of Unmatched Courage

	-- Item lvl 284 Trinkets
	[75480] = 54591,							-- Petrified Twilight Scale HEROIC 25 MAN
	[75456] = 54590,							-- Sharpened Twilight Scale HEROIC 25 MAN
	[75473] = 54588,							-- Charred Twilight Scale HEROIC 25 MAN

	-- Item lvl 277 Trinkets
	[71636] = 50365,							-- Phylactery of the Nameless Lich HEROIC 25 MAN
	[71639] = 50349,							-- Corpse Tongue Coin HEROIC 25 MAN
	[71644] = 50348,							-- Dislodged Foreign Object HEROIC 25 MAN
	[71556] = 50363,							-- Deathbringer's Will HEROIC 25 MAN - AGI
	[71558] = 50363,							-- Deathbringer's Will HEROIC 25 MAN - ATTACK POWER
	[71559] = 50363,							-- Deathbringer's Will HEROIC 25 MAN - CRIT
	[71560] = 50363,							-- Deathbringer's Will HEROIC 25 MAN - HASTE
	[71561] = 50363,							-- Deathbringer's Will HEROIC 25 MAN - STR

	-- Item lvl 271 Trinkets
	[75477] = 54571,							-- Petrified Twilight Scale 25 MAN
	[75458] = 54569,							-- Sharpened Twilight Scale 25 MAN
	[75466] = 54572,							-- Charred Twilight Scale 25 MAN

	-- Item lvl 264 Trinkets
	[71605] = 50360,							-- Phylactery of the Nameless Lich 25 MAN
	[71633] = 50352,							-- Corpse Tongue Coin 25 MAN
	[71601] = 50353,							-- Dislodged Foreign Object 25 MAN
	[71485] = 50362,							-- Deathbringer's Will 25 MAN - AGI
	[71486] = 50362,							-- Deathbringer's Will 25 MAN - ATTACK POWER
	[71491] = 50362,							-- Deathbringer's Will 25 MAN - CRIT
	[71492] = 50362,							-- Deathbringer's Will 25 MAN - HASTE
	[71484] = 50362,							-- Deathbringer's Will 25 MAN - STR
	[71584] = 50358,							-- Purified Lunar Dust
	[71541] = 50343,							-- Whispering Fanged Skull HEROIC 10 MAN
	[71577] = 50344,							-- Unidentifiable Organ HEROIC 10 MAN
	[71572] = 50345,							-- Muradin's Spyglass HEROIC 10 MAN
	[71396] = 50355,							-- Herkuml War Token

	-- Item lvl 258 Trinkets
	[67750] = {47059, 47432},						-- Solace of the Defeated, Solace of the Fallen HEROIC 25 MAN
	[67772] = {47131, 47464},						-- Death's Verdict, Death's Choice HEROIC 25 MAN AGI
	[67773] = {47131, 47464},						-- Death's Verdict, Death's Choice HEROIC 25 MAN STR

	-- Item lvl 251 Trinkets
	[71401] = 50342,							-- Whispering Fanged Skull 10 MAN
	[71575] = 50341,							-- Unidentifiable Organ 10 MAN
	[71570] = 50340,							-- Muradin's Spyglass 10 MAN

	-- Item lvl 245 Trinkets
	[67696] = {47041, 47271},						-- Solace of the Defeated, Solace of the Fallen 25 MAN
	[67703] = {47115, 47303},						-- Death's Verdict, Death's Choice 25 MAN AGI
	[67708] = {47115, 47303},						-- Death's Verdict, Death's Choice 25 MAN STR

	-- Item lvl 239 Trinkets
	[64772] = 45609, 							-- Comet's Trail
	[64739] = 45535, 							-- Show of Faith
	[64713] = 45518, 							-- Flare of the Heavens

	-- Item lvl 232 Trinkets
	[71403] = 50198,							-- Needle-Encrusted Scorpion

	-- Item lvl 226 Trinkets
	[64741] = 45490,							-- Pandora's Plea
	[65024] = 46038,							-- Dark Matter
	[65019] = 45931,							-- Mjolnir Runestone
	[65003] = 45929,							-- Sif's Remembrance
	[64790] = 45522,							-- Blood of the Old God
	[64765] = 45507,							-- The General's Heart

	-- Item lvl 219 Trinkets
	[65006] = 45308,							-- Eye of the Broodmother
	[65004] = 45866,							-- Elemental Focus Stone
	[65014] = 45286,							-- Pyrite Infuser

	-- Item lvl 213 Trinkets
	[60494] = 40255,							-- Dying Curse
	[60437] = 40256,							-- Grim Toll
	[60530] = 40258,							-- Forethought Talisman
	[60314] = 40431,							-- Fury of the Five Flights
	[60486] = 40432,							-- Illustration of the Dragon Soul

	-- Item lvl 200 Trinkets
	[60062] = {49078, 40685},						-- Ancient Pickled Egg, The Egg of Mortal Essence
	[60064] = {49076, 40682, 44912},					-- Mithril Pocketwatch, Sundial of the Exiled, Flow of Knowledge
	[60065] = {49074, 40684, 44914},					-- Coren's Chromium Coaster, Mirror of Truth, Anvil of Titans
	[67631] = 47216,							-- The Black Heart
	[67671] = 47214,							-- Banner of Victory
	[60233] = {44253, 44254, 44255, 42987},					-- Darkmoon Card: Greatness AGI
	[60235] = {44253, 44254, 44255, 42987},					-- Darkmoon Card: Greatness SPIRIT
	[60229] = {44253, 44254, 44255, 42987},					-- Darkmoon Card: Greatness INT
	[60234] = {44253, 44254, 44255, 42987},					-- Darkmoon Card: Greatness STR
	[60196] = 42989,							-- Darkmoon Card: Berserker!
	[58904] = 43573,							-- Tears of Bitter Anguish
	[67669] = 47213,							-- Abyssal Rune
	[49623] = 37835,							-- Je'Tze's Bell
	[60492] = 39229,							-- Embrace of the Spider
	[60525] = 40430,							-- Majestic Dragon Figurine
	[63250] = 45219,							-- Jouster's Fury HORDE
	[63250] = 45131,							-- Jouster's Fury ALLIANCE
	[60479] = 37660,							-- Forge Ember
	[60520] = 37657,							-- Spark of Life
	[60218] = 37220,							-- Essence of Gossamer



	-- ==================
	-- == PvP Trinkets ==
	-- ==================


	-- Item lvl 464 - 483 Trinkets
	[126707] = {84935, 84349},						-- Malevolent - Dreadful Gladiators Insignia of Conquest AGI
	[126700] = {84937, 84495},						-- Malevolent - Dreadful Gladiators Insignia of Victory STR
	[126705] = {84941, 84489},						-- Malevolent - Dreadful Gladiators Insignia of Dominance SP

	-- Item lvl 390 Trinkets
	[105139] = 73491,							-- Cataclysmic Gladiators Insignia of Victory STR
	[105137] = 73497,							-- Cataclysmic Gladiators Insignia of Dominance SP
	[105135] = 73643,							-- Cataclysmic Gladiators Insignia of Conquest AGI

	-- Item lvl 377 Trinkets
	[102439] = 72309,							-- Ruthless Gladiators Insignia of Conquest AGI
	[102435] = 72449,							-- Ruthless Gladiators Insignia of Dominance SP
	[102432] = 72455,							-- Ruthless Gladiators Insignia of Victory STR

	-- Item lvl 371 Trinkets
	[99742] = 70402,							-- Ruthless Gladiators Insignia of Dominance SP
	[99746] = 70403,							-- Ruthless Gladiators Insignia of Victory STR
	[99748] = 70404,							-- Ruthless Gladiators Insignia of Conquest AGI

	-- Item lvl 358 Trinkets
	[99717] = 70577,							-- Vicious Gladiators Insignia of Conquest AGI
	[99719] = 70578,							-- Vicious Gladiators Insignia of Dominance SP
	[99721] = 70579,							-- Vicious Gladiators Insignia of Victory STR

	-- Item lvl 351 Trinkets
	[85027] = 61045,							-- Vicious Gladiators Insignia of Dominance SP
	[85032] = 61046,							-- Vicious Gladiators Insignia of Victory STR
	[85022] = 61047								-- Vicious Gladiators Insignia of Conquest AGI
}

-- spell ID = {enchant ID, slot1[, slot2]}
local enchants =
{
	-- =======================
	-- == Mists of Pandaria ==
	-- =======================


	[125487] = {4892, 15},							-- Lightweave Embroidery (Rank 3)
	[125488] = {4893, 15},							-- Darkglow Embroidery (Rank 3)
	[125489] = {4894, 15},							-- Swordguard Embroidery (Rank 3)


	-- ===============
	-- == Cataclysm ==
	-- ===============

	[74245] = {4099, 16, 17},						-- Landslide
	[74243] = {4098, 16, 17},						-- Windwalk
	[74241] = {4097, 16, 17},						-- Power Torrent
	[74221] = {4083, 16, 17},						-- Hurricane
	[74224] = {4084, 16},							-- Heartsong
	[75170] = {4115, 15},							-- Lightweave Embroidery (Rank 2)
	[75173] = {4116, 15},							-- Darkglow Embroidery (Rank 2)
	[75176] = {4118, 15},							-- Swordguard Embroidery (Rank 2)
	[95712] = {4175, 16, 17},						-- Gnomish X-Ray Scope
	[99621] = {4267, 16, 17},						-- Flintlocke's Woodchucker


	-- ============================
	-- == Wrath of the Lich King ==
	-- ============================

	[55637] = {3722, 15},							-- Lightweave Embroidery (Rank 1)
	[55775] = {3730, 15},							-- Swordguard Embroidery (Rank 1)
	[55767] = {3728, 15},							-- Darkglow Embroidery (Rank 1)
	[59626] = {3790, 16}							-- Black Magic
}

local metas =
{
	[23454] = 25899,							-- Brutal Earthstorm Diamond
	[55341] = 41385, 							-- Invigorating Earthsiege Diamond
	[18803] = 25893,							-- Mystical Skyfire Diamond
	[32845]	= 25898,							-- Tenacious Earthstorm Diamond
	[39959] = 32410,							-- Thundering Skyfire Diamond
	[55379] = 41400								-- Thundering Skyflare Diamond
}

local cooldowns =
{
	-- =======================
	-- == Mists of Pandaria ==
	-- =======================


	-- Item lvl 483, 496, 509 Trinkets
	[126646] = 105,								-- Stuff of Nightmares LFR, Normal, HEROIC
	[126640] = 105,								-- Spirits of the Sun LFR, Normal, HEROIC
	[126649] = 105,								-- Terror in the Mists LFR, Normal, HEROIC
	[126657] = 105,								-- Darkmist Vortex LFR, Normal, HEROIC
	[126659] = 105,								-- Essence of Terror LFR, Normal, HEROIC

	-- Item lvl 476, 489, 502 Trinkets
	[126588] = 45,								-- Qin-xi's Polarizing Seal LFR, Normal, HEROIC
	[126582] = 45,								-- Lei Shin's Final Orders LFR, Normal, HEROIC
	[126577] = 45,								-- Light of the Cosmos LFR, Normal, HEROIC
	[126533] = 45,								-- Vial of Dragon's Blood LFR, Normal, HEROIC
	[126554] = 45,								-- Bottle of Infinite Stars LFR, Normal, HEROIC
	[128986] = 45,								-- Relic of Xuen STR
	[128984] = 55,								-- Relic of Xuen AGI
	[128987] = 50,								-- Relic of Chi Ji
	[128985] = 50,								-- Relic of Yu'lon

	-- Item lvl 470 Trinkets
	[127923] = 50,								-- Mithril Wristwatch
	[127915] = 50,								-- Thousand-Year Pickled Egg
	[127928] = 50,								-- Coren's Cold Chromium Coaster

	-- Item lvl 463 Trinkets
	[126236] = 60,								-- Iron Protector Talisman HEROIC
	[126483] = 65,								-- Windswept Pages HEROIC
	[126513] = 105,								-- Carbonic Carbuncle HEROIC
	[126467] = 115,								-- Price of Progress HEROIC - TEST CD ONLY, NEED CORRECT VALUES!
	[126489] = 85,								-- Searing Words HEROIC
	[126476] = 105,								-- Vision of the Predator HEROIC
	[126266] = 30,								-- Empty Fruit Barrel HEROIC

	-- Item lvl 450 Trinkets
	[105574] = 55,								-- Zen Alchemist Stone

	-- Item lvl 433 Trinkets
	[127572] = 105,								-- Core of Decency



	-- ===============
	-- == Cataclysm ==
	-- ===============


	-- Kiril, Fury of Beasts
	[109864] = 60,								-- Heroic
	[108011] = 60,								-- Normal
	[109861] = 60,								-- Raid Finder

	-- Ti'tahk, the Steps of Time
	[109844] = 60,								-- Heroic
	[107804] = 60,								-- Normal
	[109842] = 60,								-- Raid Finder

	-- Gurthalak, Voice of the Deeps
	[109840] = 60,								-- Heroic
	[107818] = 60,								-- Normal
	[109838] = 60,								-- Raid Finder

	-- Item lvl 410 Trinkets
	[109744] = 115,								-- Creche of the Final Dragon HEROIC
	[109789] = 115,								-- Insignia of the Corrupted Mind HEROIC
	[109804] = 115,								-- Seal of the Seven Signs HEROIC
	[109776] = 115,								-- Soulshifter Vortex HEROIC
	[109711] = 115,								-- Starcatcher Compass HEROIC

	-- Item lvl 397 Trinkets
	[107988] = 115,								-- Creche of the Final Dragon
	[107982] = 115,								-- Starcatcher Compass, Insignia of the Corrupted Mind, Seal of the Seven Signs
	[107986] = 115,								-- Soulshifter Vortex
	[97139] = 105,								-- Matrix Restabilizer Haste
	[97140] = 105,								-- Matrix Restabilizer Crit
	[97141] = 105,								-- Matrix Restabilizer Mastery

	-- Item lvl 391 Trinkets
	[97177] = 60,								-- Ancient Petrified Seed HEROIC
	[97179] = 60,								-- Essence of the Eternal Flame HEROIC
	[97176] = 90,								-- Fiery Quintessence HEROIC
	[97120] = 120,								-- Jaws of Defeat HEROIC
	[97146] = 60,								-- Rune of Zeth HEROIC
	[96880] = 60,								-- Scales of Life HEROIC
	[97129] = 60,								-- Spidersilk Spindle HEROIC
	[97145] = 120,								-- Stay of Execution HEROIC
	[97125] = 60,								-- The Hungerer HEROIC

	-- Item lvl 384 Trinkets
	[109742] = 115,								-- Creche of the Final Dragon LFR
	[109787] = 115,								-- Insignia of the Corrupted Mind LFR
	[109802] = 115,								-- Seal of the Seven Signs LFR
	[109774] = 115,								-- Soulshifter Vortex LFR
	[109709] = 115,								-- Starcatcher Compass LFR
	[96977] = 105,								-- Matrix Restabilizer Haste
	[96978] = 105,								-- Matrix Restabilizer Crit
	[96979] = 105,								-- Matrix Restabilizer Mastery

	-- Item lvl 379 Trinkets
	[91173] = 60,								-- Shard of Woe

	-- Item lvl 378 Trinkets
	[97009] = 60,								-- Ancient Petrified Seed
	[102659] = 50,								-- Arrow of Time
	[97010] = 60,								-- Essence of the Eternal Flame
	[97008] = 90,								-- Fiery Quintessence
	[102662] = 50,								-- Foul Gift of the Demon Lord
	[96907] = 120,								-- Jaws of Defeat
	[109993] = 50,								-- Master Pit Fighter
	[102660] = 50,								-- Rosary of Light
	[97007] = 60,								-- Rune of Zeth
	[96880] = 60,								-- Scales of Life
	[96945] = 60,								-- Spidersilk Spindle
	[96988] = 120,								-- Stay of Execution
	[96911] = 60,								-- The Hungerer
	[102664] = 50,								-- Varo'then's Brooch
	[102667] = 50,								-- Veil of Lies

	-- Item lvl 372 Trinkets
	[92318] = 100,								-- Bell of Enraging Resonance
	[92342] = 75,								-- Crushing Weight
	[92351] = 50,								-- Essence of the Cyclone
	[92332] = 75,								-- Fall of Mortality
	[92345] = 100,								-- Heart of Rage
	[92349] = 75,								-- Prestor's Talisman of Machination
	[92355] = 30,								-- Symbiotic Worm
	[92320] = 50,								-- Theralion's Mirror

	-- Item lvl 365 Trinkets
	[101287] = 50,								-- Coren's Chilled Chromium Coaster
	[101291] = 50,								-- Mithril Stopwatch
	[101289] = 50,								-- Petrified Pickled Egg
	[109994] = 50,								-- Pit Fighter

	-- Item lvl 359 Trinkets
	[92233] = 30,								-- Bedrock Talisman
	[91007] = 100,								-- Bell of Enraging Resonance
	[91821] = 75,								-- Crushing Weight
	[89091] = 50,								-- Darkmoon Card: Volcano
	[92126] = 50,								-- Essence of the Cyclone
	[91184] = 75,								-- Fall of Mortality
	[91816] = 100,								-- Heart of Rage
	[91192] = 50,								-- Mandala of Stirring Patterns
	[92124] = 75,								-- Prestor's Talisman of Machination
	[91047] = 75,								-- Stump of Time
	[92235] = 30,								-- Symbiotic Worm
	[91024] = 50,								-- Theralion's Mirror
	[92108] = 50,								-- Unheeded Warning

	-- Item lvl 346 Trinkets
	[90992] = 50,								-- Anhuur's Hymnal HEROIC
	[91149] = 100,								-- Blood of Isiset HEROIC
	[92087] = 50,								-- Grace of the Herald HEROIC
	[91364] = 100,								-- Heart of Solace HEROIC
	[92091] = 75,								-- Key to the Endless Chamber HEROIC
	[92184] = 30,								-- Leaden Despair HEROIC
	[92094] = 50,								-- Left Eye of Rajh HEROIC
	[92174] = 80,								-- Porcelain Crab HEROIC
	[91368] = 50,								-- Right Eye of Rajh HEROIC
	[91002] = 20,								-- Sorrowsong HEROIC
	[91139] = 75,								-- Tear of Blood HEROIC
	[90898] = 75,								-- Tendrils of Burrowing Dark HEROIC
	[92205] = 60,								-- Throngus's Finger HEROIC
	[90887] = 75,								-- Witching Hourglass HEROIC

	-- Item lvl 308-333 Trinkets
	[90989] = 50,								-- Anhuur's Hymnal
	[91147] = 100,								-- Blood of Isiset
	[91363] = 100,								-- Heart of Solace
	[92096] = 50,								-- Left Eye of Rajh
	[91370] = 50,								-- Right Eye of Rajh
	[90996] = 20,								-- Sorrowsong
	[92208] = 60,								-- Throngus's Finger
	[92166] = 80,								-- Harrison's Insignia of Panache, Schnotzz's Medallion of Command, Talisman of Sinister Order, Porcelain Crab 
	[92052] = 50,								-- Heart of the Vile, Grace of the Herald 
	[92069] = 75,								-- Key to the Endless Chamber
	[92179] = 30,								-- Leaden Despair
	[91141] = 75,								-- Rainsong
	[91138] = 75,								-- Tear of Blood
	[90896] = 75,								-- Tendrils of Burrowing Dark
	[90885] = 75,								-- Witching Hourglass



	-- ============================
	-- == Wrath of the Lich King ==
	-- ============================


	-- ICC Reputation Rings
	[72416] = 60,								-- Ashen Band of Endless Destruction, Ashen Band of Unmatched Destruction
	[72418] = 60,								-- Ashen Band of Endless Wisdom, Ashen Band of Unmatched Wisdom
	[72412] = 60,								-- Ashen Band of Endless Vengeance, Ashen Band of Unmatched Vengeance
	[72414] = 60,								-- Ashen Band of Endless Courage, Ashen Band of Unmatched Courage

	-- Item lvl 284 Trinkets
	[75480] = 45,								-- Petrified Twilight Scale HEROIC
	[75456] = 45,								-- Sharpened Twilight Scale HEROIC
	[75473] = 45,								-- Charred Twilight Scale HEROIC

	-- Item lvl 277 Trinkets
	[71636] = 90,								-- Phylactery of the Nameless Lich HEROIC 25 MAN
	[71639] = 30,								-- Corpse Tongue Coin HEROIC 25 MAN
	[71644] = 45,								-- Dislodged Foreign Object HEROIC 25 MAN
	[71556] = 105,								-- Deathbringer's Will HEROIC 25 MAN - AGI
	[71558] = 105,								-- Deathbringer's Will HEROIC 25 MAN - ATTACK POWER
	[71559] = 105,								-- Deathbringer's Will HEROIC 25 MAN - CRIT
	[71560] = 105,								-- Deathbringer's Will HEROIC 25 MAN - HASTE
	[71561] = 105,								-- Deathbringer's Will HEROIC 25 MAN - STR

	-- Item lvl 271 Trinkets
	[75477] = 45,								-- Petrified Twilight Scale 25 MAN
	[75458] = 45,								-- Sharpened Twilight Scale 25 MAN
	[75466] = 45,								-- Charred Twilight Scale 25 MAN

	-- Item lvl 264 Trinkets
	[71605] = 90,								-- Phylactery of the Nameless Lich 25 MAN
	[71633] = 30,								-- Corpse Tongue Coin 25 MAN
	[71601] = 45,								-- Dislodged Foreign Object 25 MAN
	[71485] = 105,								-- Deathbringer's Will 25 MAN - AGI
	[71486] = 105,								-- Deathbringer's Will 25 MAN - ATTACK POWER
	[71491] = 105,								-- Deathbringer's Will 25 MAN - CRIT
	[71492] = 105,								-- Deathbringer's Will 25 MAN - HASTE
	[71484] = 105,								-- Deathbringer's Will 25 MAN - STR
	[71584] = 45,								-- Purified Lunar Dust
	[71541] = 45,								-- Whispering Fanged Skull HEROIC 10 MAN
	[71577] = 45,								-- Unidentifiable Organ HEROIC 10 MAN
	[71572] = 45,								-- Muradin's Spyglass HEROIC 10 MAN
	[71396] = 45,								-- Herkuml War Token

	-- Item lvl 258 Trinkets
	[67750] = 45,								-- Solace of the Defeated, Solace of the Fallen HEROIC 25 MAN
	[67772] = 45,								-- Death's Verdict, Death's Choice HEROIC 25 MAN AGI
	[67773] = 45,								-- Death's Verdict, Death's Choice HEROIC 25 MAN STR

	-- Item lvl 251 Trinkets
	[71401] = 45,								-- Whispering Fanged Skull 10 MAN
	[71575] = 45,								-- Unidentifiable Organ 10 MAN
	[71570] = 45,								-- Muradin's Spyglass 10 MAN

	-- Item lvl 245 Trinkets
	[67696] = 45,								-- Solace of the Defeated, Solace of the Fallen 25 MAN
	[67703] = 45,								-- Death's Verdict, Death's Choice 25 MAN AGI
	[67708] = 45,								-- Death's Verdict, Death's Choice 25 MAN STR

	-- Item lvl 239 Trinkets
	[64772] = 45, 								-- Comet's Trail
	[64739] = 45, 								-- Show of Faith
	[64713] = 45, 								-- Flare of the Heavens

	-- Item lvl 232 Trinkets
	[71403] = 45,								-- Needle-Encrusted Scorpion HEROIC

	-- Item lvl 226 Trinkets
	[64741] = 45,								-- Pandora's Plea
	[65024] = 45,								-- Dark Matter
	[65019] = 45,								-- Mjolnir Runestone
	[65003] = 45,								-- Sif's Remembrance
	[64790] = 45,								-- Blood of the Old God
	[64765] = 45,								-- The General's Heart

	-- Item lvl 219 Trinkets
	[65006] = 45,								-- Eye of the Broodmother
	[65004] = 45,								-- Elemental Focus Stone
	[65014] = 45,								-- Pyrite Infuser

	-- Item lvl 213 Trinkets
	[60494] = 45,								-- Dying Curse
	[60437] = 45,								-- Grim Toll
	[60530] = 15,								-- Forethought Talisman
	[60314] = 45,								-- Fury of the Five Flights
	[60486] = 45,								-- Illustration of the Dragon Soul

	-- Item lvl 200 Trinkets
	[60062] = 50,								-- Ancient Pickled Egg, The Egg of Mortal Essence
	[60064] = 50,								-- Mithril Pocketwatch, Sundial of the Exiled, Flow of Knowledge
	[60065] = 50,								-- Coren's Chromium Coaster, Mirror of Truth, Anvil of Titans
	[67631] = 45,								-- The Black Heart
	[67671] = 45,								-- Banner of Victory
	[60233] = 45,								-- Darkmoon Card: Greatness AGI
	[60235] = 45,								-- Darkmoon Card: Greatness SPIRIT
	[60229] = 45,								-- Darkmoon Card: Greatness INT
	[60234] = 45,								-- Darkmoon Card: Greatness STR
	[60196] = 45,								-- Darkmoon Card: Berserker
	[58904] = 45,								-- Tears of Bitter Anguish
	[67669] = 45,								-- Abyssal Rune
	[49623] = 45,								-- Je'Tze's Bell
	[60492] = 45,								-- Embrace of the Spider
	[60525] = 45,								-- Majestic Dragon Figurine
	[63250] = 45,								-- Jouster's Fury HORDE
	[63250] = 45,								-- Jouster's Fury ALLIANCE
	[60479] = 45,								-- Forge Ember
	[60520] = 45,								-- Spark of Life
	[60218] = 45,								-- Essence of Gossamer



	-- ==================
	-- == PvP Trinkets ==
	-- ==================


	-- Item lvl 464 - 483 Trinkets
	[126707] = 50,								-- Malevolent - Dreadful Gladiators Insignia of Conquest AGI
	[126700] = 50,								-- Malevolent - Dreadful Gladiators Insignia of Victory STR
	[126705] = 50,								-- Malevolent - Dreadful Gladiators Insignia of Dominance SP

	-- Item lvl 390 Trinkets
	[105139] = 50,								-- Cataclysmic Gladiators Insignia of Victory STR
	[105137] = 50,								-- Cataclysmic Gladiators Insignia of Dominance SP
	[105135] = 50,								-- Cataclysmic Gladiators Insignia of Conquest AGI

	-- Item lvl 377 Trinkets
	[102439] = 50,								-- Ruthless Gladiators Insignia of Conquest AGI
	[102435] = 50,								-- Ruthless Gladiators Insignia of Dominance SP
	[102432] = 50,								-- Ruthless Gladiators Insignia of Victory STR

	-- Item lvl 371 Trinkets
	[99742] = 50,								-- Ruthless Gladiators Insignia of Dominance SP
	[99746] = 50,								-- Ruthless Gladiators Insignia of Victory STR
	[99748] = 50,								-- Ruthless Gladiators Insignia of Conquest AGI

	-- Item lvl 358 Trinkets
	[99717] = 50,								-- Vicious Gladiators Insignia of Conquest AGI
	[99719] = 50,								-- Vicious Gladiators Insignia of Dominance SP
	[99721] = 50,								-- Vicious Gladiators Insignia of Victory STR

	-- Item lvl 351 Trinkets
	[85027] = 50,								-- Vicious Gladiators Insignia of Dominance SP
	[85032] = 50,								-- Vicious Gladiators Insignia of Victory STR
	[85022] = 50,								-- Vicious Gladiators Insignia of Conquest AGI



	-- ================================
	-- == Mists of Pandaria ENCHANTS ==
	-- ================================


	[125487] = 55,								-- Lightweave Embroidery (Rank 3)
	[125488] = 55,								-- Darkglow Embroidery (Rank 3)
	[125489] = 55,								-- Swordguard Embroidery (Rank 3)


	-- ========================
	-- == Cataclysm ENCHANTS ==
	-- ========================

	[74245] = 45,								-- Landslide
	[74243] = 45,								-- Windwalk
	[74241] = 50,								-- Power Torrent
	[74221] = 45,								-- Hurricane
	[74224] = 20,								-- Heartsong
	[75170] = 45,								-- Lightweave Embroidery (Rank 2)
	[75173] = 45,								-- Darkglow Embroidery (Rank 2)
	[75176] = 45,								-- Swordguard Embroidery (Rank 2)
	[95712] = 45,								-- Gnomish X-Ray Scope
	[99621] = 45,								-- Flintlocke's Woodchucker


	-- =====================================
	-- == Wrath of the Lich King ENCHANTS ==
	-- =====================================

	[55637] = 45,								-- Lightweave Embroidery (Rank 1)
	[55775] = 45,								-- Swordguard Embroidery (Rank 1)
	[55767] = 45,								-- Darkglow Embroidery (Rank 1)
	[59626] = 35,								-- Black Magic


	-- ===============
	-- == Meta Gems ==
	-- ===============

	[23454] = 45,								-- Brutal Earthstorm Diamond
	[55341] = 45, 								-- Invigorating Earthsiege Diamond
	[18803] = 45,								-- Mystical Skyfire Diamond
	[32845]	= 45,								-- Tenacious Earthstorm Diamond
	[39959] = 45,								-- Thundering Skyfire Diamond
	[55379] = 45								-- Thundering Skyflare Diamond
}

local talents =
{
	-- Hunter
	[56453] = "Lock and Load",

	-- Death Knight
	[52286] = "Will of the Necropolis",

	-- Priest
	[47755] = "Rapture",

	-- Warrior
	[129020] ="Avatar",
}

lib.spellToItem = lib.spellToItem or {}
lib.cooldowns = lib.cooldowns or {}
lib.enchants = lib.enchants or {}
lib.metas = lib.metas or {}
lib.talents = lib.talents or {}

local tt, tts = {}, {}

local function merge(t1, t2)
	wipe(tts)

	for _, v in ipairs(t1) do
		tts[v] = true
	end

	for _, v in ipairs(t2) do
		if not tts[v] then
			tinsert(t1, v)
		end
	end
end

for k, v in pairs(spellToItem) do
	local e = lib.spellToItem[k]

	if e and e ~= v then
		if type(e) == "table" then
			if type(v) ~= "table" then
				wipe(tt)
				tinsert(tt, v)
			end

			merge(e, tt)
		else
			lib.spellToItem[k] = {e, v}
		end

	else
		lib.spellToItem[k] = v
	end
end

for k, v in pairs(cooldowns) do
	lib.cooldowns[k] = v
end

for k, v in pairs(enchants) do
	lib.enchants[k] = v
end

for k, v in pairs(metas) do
	lib.metas[k] = v
end

for k, v in pairs(talents) do
	lib.talents[k] = v
end